/*
 * @(#)PropertiesUtils.java
 * Copyright 2011 TravelSky Technology Ltd. All Right Reserved. 
 */
package com.meetingshow.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * @author louyi
 *
 */
public class PropertiesFactory {
	private Map<String, Properties> propMap;
	
	private PropertiesFactory() {
		propMap = new HashMap<String, Properties>();
	}
	
	private static class SingletonHolder {
		public static final PropertiesFactory INSTANCE = new PropertiesFactory();
	}
	
	public static PropertiesFactory getInstance() {
		return SingletonHolder.INSTANCE;
	}
	
	public Properties createProperties(String fileName) throws Exception {
		Properties config = (Properties) propMap.get(fileName);
		if (config == null) {
			config = new Properties(fileName);
			propMap.put(fileName, config);
		}
		return config;
	}
}
